x86/mm: ASSERT we are putting the right gfn in the XENMAPSPACE_gmfn* cases
authorAndres Lagar-Cavilla <andres@lagarcavilla.org>
Thu, 24 Nov 2011 16:34:34 +0000 (16:34 +0000)
committerAndres Lagar-Cavilla <andres@lagarcavilla.org>
Thu, 24 Nov 2011 16:34:34 +0000 (16:34 +0000)
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/mm.c

index f9db1a6d910c1fec580f1499a59c99aecda036cf..8b4ab90d21b79772299543dc4446967410dd3f7d 100644 (file)
@@ -4773,13 +4773,16 @@ static int xenmem_add_to_physmap_once(
     /* Unmap from old location, if any. */
     gpfn = get_gpfn_from_mfn(mfn);
     ASSERT( gpfn != SHARED_M2P_ENTRY );
+    if ( xatp->space == XENMAPSPACE_gmfn ||
+         xatp->space == XENMAPSPACE_gmfn_range )
+        ASSERT( gpfn == gfn );
     if ( gpfn != INVALID_M2P_ENTRY )
         guest_physmap_remove_page(d, gpfn, mfn, PAGE_ORDER_4K);
 
     /* Map at new location. */
     rc = guest_physmap_add_page(d, xatp->gpfn, mfn, PAGE_ORDER_4K);
 
-    /* In the XENMAPSPACE_gmfn, we took a ref and locked the p2m at the top */
+    /* In the XENMAPSPACE_gmfn, we took a ref of the gfn at the top */
     if ( xatp->space == XENMAPSPACE_gmfn ||
          xatp->space == XENMAPSPACE_gmfn_range )
         put_gfn(d, gfn);